par(mfrow=c(1,2))

stap=0.01;seq=seq(0.005,.995,0.01)
A=dbinom(1,5,seq);A=A/(sum(A)*stap);sum(seq*A)*stap
B=dbinom(10,20,seq);B=B/(sum(B)*stap);sum(seq*B)*stap
C=dbinom(32,40,seq);C=C/(sum(C)*stap);sum(seq*C)*stap

plot(seq,A,type='l',col='blue',lwd=2,ylim=c(0,8),axes=FALSE,
main=c(paste('1A. Example: Individual Profiles'),
paste('for Respondents A, B, and C')),
xlab='Probability of Behaviour',ylab='Plausibility')
axis(side=1,at=seq(0,1,0.1));axis(side=2,at=seq(0,8,2),las=1)
lines(seq,B,type='l',lwd=2,col='red')
lines(seq[20:100],C[20:100],type='l',lwd=2,col='green3')

arrows(0.29,0,0.29,A[29],col='blue',length=0,lty=2)
arrows(0.50,0,0.50,B[51],col='red',length=0,lty=2)
arrows(0.79,0,0.79,C[79],col='green3',length=0,lty=2)

legend('topleft',bty='n',c('Profile for Respondent A',
'Profile for Respondent B','Profile for Respondent C'),
cex=0.9,col=c('blue','red','green3'),lty=c(1,1,1))

######################################

par(mfrow=c(1,2))

D=(A+B)/2;sum(seq*D)*stap

plot(seq,D,type='l',col='magenta',lwd=2,ylim=c(0,8),axes=FALSE,
main=c(paste('1B. Group Profile Based on'),paste('Respondents A and B')),
xlab='Probability of Behaviour',ylab='Plausibility')
axis(side=1,at=seq(0,1,0.1));axis(side=2,at=seq(0,8,2),las=1)

arrows(0.40,0,0.40,D[40],col='magenta',length=0,lty=2)

legend('top',bty='n',c('Group Profile (Respondents A and B)'),
cex=0.9,col=c('magenta'),lty=1)

###########################

E=(A+B+C)/3;sum(seq*E)*stap

plot(seq,E,type='l',col='orange',lwd=2,ylim=c(0,8),axes=FALSE,
main=c(paste('1C. Group Profile Based on'),paste('Respondents A, B, and C')),
xlab='Probability of Behaviour',ylab='Plausibility')
axis(side=1,at=seq(0,1,0.1));axis(side=2,at=seq(0,8,2),las=1)

arrows(0.53,0,0.53,E[53],col='orange',length=0,lty=2)

legend('top',bty='n',c('Group Profile (Respondents A, B, and C)'),
cex=0.9,col=c('orange'),lty=1)




